<?php
if (!defined('GmhLiger')) {
    exit(1);
}

function mydate() {
    return date("Y-m-d H:i:s");
}

function fileoperate($path) {
    if (!is_readable($path)) {
        fileoperate(dirname($path));
        if (!is_file($path))
            mkdir($path, 0777);
    }
}

    function write_cache($filename, $val) {
    $filepath = 'uploads/' . $filename . '.php';
    $content = "<?php\\n";
    $content .= "\$data = " . var_export($val, true) . ";\\n";
    $content .= "?>";
    file_put_contents($filepath, $content, LOCK_EX);
}
function read_cache($filename) {
    $result = array();
    if (!empty($result[$filename])) {
        return $result[$filename];
    }
    $filepath = 'uploads/' . $filename . '.php';
    if (file_exists($filepath)) {
        include_once($filepath);
        $result[$filename] = $data;
        return $result[$filename];
    } else {
        return false;
    }
}
function array_iconv($in_charset, $out_charset, $arr) { //数组编码转化
    return eval('return ' . iconv($in_charset, $out_charset, var_export($arr, true) . ';'));
}

?>